<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
				xmlns:ui="http://java.sun.com/jsf/facelets"
				xmlns:h="http://java.sun.com/jsf/html"
				xmlns:a4j="http://richfaces.org/a4j"
				xmlns:rich="http://richfaces.org/rich"
				xmlns:f="http://java.sun.com/jsf/core"
				xmlns:t="http://myfaces.apache.org/tomahawk"
				template="/pages/search_template.xhtml"> 

	<ui:param name="crudBean" value="#{consultaTaxasAdministracaoBean}" />
	
	<ui:define name="saveStateObjectsDefined">
		<t:saveState value="#{crudBean.listaEstLojas}" />
		<t:saveState value="#{crudBean.listaBandeiras}" />
		<t:saveState value="#{crudBean.listaProdutos}" />
	</ui:define>
	
	<ui:define name="requiredFieldsMessage">
		<h:outputText value="#{bundle.todosCamposObrigatorios}" rendered="#{crudBean.searching}"/>
	</ui:define>
	
	<ui:define name="content">
		<!-- Painel de Pesquisa - Inicio -->
		<h:panelGroup id="panelGroupDePesquisa" rendered="#{crudBean.searching}">
			<f:subview id="viewBusca">
				<table>
					<tr>
						<td class="tdCor"><h:outputText value="#{bundle.lbl_periodo_vendas}"/> *</td>
						<td class="tdBranco">
							<rich:calendar value="#{crudBean.searchObject.filtro.dataVendaInicial}" datePattern="dd/MM/yyyy" cellWidth="24px" cellHeight="22px" style="width:200px" showWeeksBar="false" inputSize="10" converter="dataConverter" oninputkeypress="formataData(this, event);" maxlength="10" onkeypress="soNumero(this);" enableManualInput="true"/>
							<h:outputText value=" #{bundle.lbl_ate} "/>
							<rich:calendar value="#{crudBean.searchObject.filtro.dataVendaFinal}" datePattern="dd/MM/yyyy" cellWidth="24px" cellHeight="22px" style="width:200px" showWeeksBar="false" inputSize="10" converter="dataConverter" oninputkeypress="formataData(this, event);" maxlength="10" onkeypress="soNumero(this);" enableManualInput="true"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="20%"><h:outputText value="#{bundle.lbl_loja}"/></td>
						<td class="tdBranco">
							<h:selectOneMenu value="#{crudBean.searchObject.loja}" converter="simpleIndexConverter">
    							<t:selectItems var="o" itemValue="#{o.codigo}" itemLabel="#{o.descricao}" value="#{crudBean.listaEstLojas}" />
    						</h:selectOneMenu>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="25%"><h:outputText value="#{bundle.lbl_bandeira}"/></td>
						<td class="tdBranco">
							<h:selectOneMenu value="#{crudBean.searchObject.bandeira}" converter="simpleIndexConverter">
    							<t:selectItems var="o" itemValue="#{o.codigo}" itemLabel="#{o.descricao}" value="#{crudBean.listaBandeiras}" />
								<a4j:support event="onchange" reRender="panelGroupDePesquisa" actionListener="#{crudBean.setarListaProdutos}"/>
    						</h:selectOneMenu>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="25%"><h:outputText value="#{bundle.lbl_produto}"/></td>
						<td class="tdBranco">
							<h:selectOneMenu value="#{crudBean.searchObject.produto}" converter="simpleIndexConverter">
    							<t:selectItems var="o" itemValue="#{o.codigo}" itemLabel="#{o.descricao}" value="#{crudBean.listaProdutos}" />
    						</h:selectOneMenu>
						</td>
					</tr>
				</table>
			</f:subview>
		</h:panelGroup>
		<!-- Painel de Pesquisa - Fim -->

		
	</ui:define>
	
	<ui:define name="list">
		<h:panelGroup id="panelGroupDeListagem" rendered="#{crudBean.searching}">
			<f:subview id="viewListagem">
				<rich:dataTable id="tblData" value="#{crudBean.searchResult}" binding="#{crudBean.tblData}" var="rst" style="width: 100%;" rowClasses="par,impar">
					<f:facet name="header">
						<rich:columnGroup>
							<rich:column style="text-align: center;">
								<h:outputText value="#{bundle.lbl_data_venda}" />
							</rich:column>
							<rich:column style="text-align: left;">
								<h:outputText value="#{bundle.lbl_loja}" />
							</rich:column>
							<rich:column style="text-align: left;">
								<h:outputText value="#{bundle.lbl_bandeira}" />
							</rich:column>
							<rich:column style="text-align: left;">
								<h:outputText value="#{bundle.lbl_produto}" />
							</rich:column>
							<rich:column style="text-align: rigth;">
								<h:outputText value="#{bundle.lbl_valor_bruto}" />
							</rich:column>
							<rich:column style="text-align: rigth;">
								<h:outputText value="#{bundle.lbl_valor_liquido}" />
							</rich:column>
							<rich:column style="text-align: rigth;">
								<h:outputText value="#{bundle.lbl_valor_administracao}" />
							</rich:column>
							<rich:column style="text-align: rigth;">
								<h:outputText value="#{bundle.lbl_taxa_administracao}" />
							</rich:column>
						</rich:columnGroup>
					</f:facet>
					
					<rich:column style="text-align: center;">
						<h:outputText value="#{rst.dataVenda}"/>
					</rich:column>
					<rich:column style="text-align: left;">
						<h:outputText value="#{rst.nomeLoja}"/>
					</rich:column>
					<rich:column style="text-align: left;">
						<h:outputText value="#{rst.nomeBandeira}"/>
					</rich:column>
					<rich:column style="text-align: left;">
						<h:outputText value="#{rst.nomeProduto}"/>
					</rich:column>
					<rich:column style="text-align: right;">
						<h:outputText value="#{rst.valorBruto}"/>
					</rich:column>
					<rich:column style="text-align: right;">
						<h:outputText value="#{rst.valorLiquido}"/>
					</rich:column>
					<rich:column style="text-align: right;">
						<h:outputText value="#{rst.valorComissao}"/>
					</rich:column>
					<rich:column style="text-align: right;">
						<h:outputText value="#{rst.taxa}"/>
					</rich:column>
					
					<f:facet name="footer">
						<rich:columnGroup>
							<rich:column colspan="4" style="text-align: right;">
								<h:outputText value="#{bundle.lbl_total}"/>
							</rich:column>
							<rich:column style="text-align: right;">
								<h:outputText value="#{crudBean.valorTotalBruto}"/>
							</rich:column>
							<rich:column style="text-align: right;">
								<h:outputText value="#{crudBean.valorTotalLiquido}"/>
							</rich:column>
							<rich:column style="text-align: right;">
								<h:outputText value="#{crudBean.valorTotalComissao}"/>
							</rich:column>
							<rich:column style="text-align: right;">
								<h:outputText value="#{crudBean.valorTotalTaxaAdministracao}"/>
							</rich:column>
						</rich:columnGroup>
					</f:facet>
				</rich:dataTable>
			</f:subview>
		</h:panelGroup>
		
	</ui:define>

</ui:composition>